package com.hustcs.mindmap.drawmap;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Handler;
import android.os.Message;
import android.view.SurfaceHolder;
import android.view.View;

import com.hustcs.mindmap.database.NodeTree;
import com.hustcs.mindmap.drawmap.shapes.Shape;

public class DrawMapView extends View implements SurfaceHolder.Callback {
	private Handler myHandler;
	private Node node;
	private Shape shape;
	private Paint paint;
	private String filepath;
	private NodeTree nodeTree;	
	
	private static final int ADD_NODE = 0;
	private static final int EDIT_NODE = 1;
	private static final int MOVE_NODE = 2;
	private static final int REMOVE_NODE = 3;
	
	
	public DrawMapView(Context context, String filepath) {
		super(context);
		this.filepath = filepath; 
	}

	public void onDraw(Canvas canvas) {
		/*paint = new Paint();
		paint.setColor(Color.BLACK);
		shape = new Rectangle(20, 20, canvas, paint);
		node = new Node(20, 20, canvas, paint, shape);
		node.draw();*/
		myHandler = new Handler() {
			public void handleMessage(Message msg) {
				switch (msg.what) {
				case ADD_NODE:
					break;
				case EDIT_NODE:
					break;
				case MOVE_NODE:
					break;
				case REMOVE_NODE:
					break;
				default:
					break;
				}
			}
		};
		
	}
	public Handler getHandler() {
		return myHandler;
	}
	
	public void addNode(int x, int y, Shape shape) {
		
	}

	@Override
	public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
		
	}

	@Override
	public void surfaceCreated(SurfaceHolder holder) {
		
	}

	@Override
	public void surfaceDestroyed(SurfaceHolder holder) {
		
	}

}
